package com.sh169.utils.urlmatch;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

public class AntUrlMatcherTest{

	AntPathMatcher matcher = null;
	@Before
	public void setUp(){
		matcher = new AntPathMatcher(); 
	}
	@Test
	public void match1(){
		Assert.assertTrue(matcher.match("/**","/tiantian/cond/asdf.do"));
		Assert.assertTrue(matcher.match("/*/cond/*","/tiantian/cond/asdf.do"));
		Assert.assertTrue(matcher.match("/tiantian/*/asdf.do","/tiantian/cond/asdf.do"));
		Assert.assertTrue(matcher.match("/tiantian/cond/*","/tiantian/cond/asdf.do"));
		Assert.assertTrue(matcher.match("/tiantian/**","/tiantian/"));
		Assert.assertTrue(matcher.match("/tiantian/**","/tiantian/asdfa/asdf"));
		Assert.assertFalse(matcher.match("/*","/tiantian/cond/asdf.do"));
	}
}
